package com.lwj.liwanjia.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.lwj.liwanjia.R;
import com.lwj.liwanjia.bean.RightBean;
import com.superrecycleview.superlibrary.adapter.BaseViewHolder;
import com.superrecycleview.superlibrary.adapter.SuperBaseAdapter;

import java.util.List;

/**
 * Created by Administrator on 2017/11/1.
 */

public class RightAdapter extends SuperBaseAdapter<RightBean.DataBean> {

    private Context context;

    public RightAdapter(Context context, List<RightBean.DataBean> data) {
        super(context, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder holder, RightBean.DataBean item, int position) {
        Glide.with(context).load(item.getImageUrl()).into((ImageView) holder.getView(R.id.iv_image));
        holder.setText(R.id.tv_name, item.getCommodityName())
                .setText(R.id.tv_pingfen, "评分：" + item.getGrade())
                .setText(R.id.tv_price, "￥" + item.getCommodityVipPrice())
                .setText(R.id.tv_jiesao, item.getCommodityInfo())
                .setText(R.id.tv_kucun, "库存量：" + item.getStock());
    }

    @Override
    protected int getItemViewLayoutId(int position, RightBean.DataBean item) {
        return R.layout.right_item;
    }
}
